﻿<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0">
    <meta name="apple-mobile-web-app-capable" content="yes" />
    <title>登录</title>
    <link rel="stylesheet" type="text/css" href="/ViewMob/css/default.css">
    <link href="/ViewMob/css/reset.css" rel="stylesheet" type="text/css">
    <link href="/ViewMob/js/layer/need/layer.css" rel="stylesheet" />
    <script src="/ViewMob/js/layer/layer.m.js"></script>
    <script type='text/javascript' src='//g.alicdn.com/sj/lib/zepto/zepto.min.js' charset='utf-8'></script> 
    <script src="/ViewMob/js/avalon.mobile.js"></script>
    <script src="/ViewMob/js/ComFunJS.js"></script>
    <script src="/ViewMob/js/zepto.md5.js"></script>
    <script>
        //
        model = avalon.define({
            $id: "Login",
            Phone: "",
            Pasword: "",
            LoginUser: function (dom) {
                var msg = "";
                $(dom).text("正在登录");
                $(dom).prop("disabled", true);
                if ($.trim(model.Phone) == "") {
                    msg = "请输入手机号";
                }
                if (!model.Phone || !(/^1[3|4|5|8|7][0-9]\d{8}$/).test(model.Phone)) {

                    msg = "请输入正确的手机号";
                }
                if ($.trim(model.Pasword) == "") {
                    msg = "请输入密码";

                }
                if (msg) {
                    ComFunJS.winwarning(msg);
                    $(dom).text("立即注册");
                    $(dom).removeAttr("disabled");
                    return;
                }
                $.post("/API/VIEWAPI.ashx?Action=Commanage_LOGIN&r=" + Math.random(), { "UserName": model.Phone, password: model.Pasword }, function (data) {
                    var data = $.parseJSON(data);
                    if (data.ErrorMsg == "") { 
                        ComFunJS.setCookie('qjycode', data.Result);
                        ComFunJS.setCookie('username', data.Result1, 20000);
                        location.href = "UI_AddKC.html";
                    }
                    else {
                        ComFunJS.winwarning(data.ErrorMsg);
                        $(dom).text("登录");
                        $(dom).prop("disabled",false);
                    }
                })
            }
        })
    </script>
</head>
<body style="display:table;width:100%" ms-controller="Login">
    <div class="form-box">
        <div class="logo-teacher tc">
            <img src="/ViewMob/images/tea.png">
        </div>
        <div class="input-panel">
            <input type="tel" placeholder="手机号" ms-duplex="Phone">
        </div>
        <div class="input-panel">
            <input type="password" placeholder="密码" ms-duplex="Pasword">
        </div>
        <div class="input-panel-btn">
            <button ms-click="LoginUser(this)">
                登录
            </button>
            <div class="login-zc">没有账号？<a href="UI_Regit.html" external>去注册</a></div>
        </div>
    </div>
</body>
</html>